import {renderRoutes, RouteConfig} from 'react-router-config';
import {Route} from '@ant-design/pro-layout/lib/typings';
import {RightOutlined} from '@ant-design/icons';
import React from 'react';

import Scenic from '@/pages/scenic';
import Dynamic from '@/pages/dynamic';
import Strategy from '@/pages/strategy';
import Idol from '@/pages/idol';
import Venue from '@/pages/venue';
import Home from '@/pages/home';
import TreeAdoption from '@/pages/tree-adoption';
import TreeInfo from '@/pages/tree-adoption/tree-info';

export default [
   {
      path: '/home',
      component: Home,
      name: '系统首页',
      icon: React.createElement(RightOutlined)
   },

   {
      path: '/scenic',
      component: Scenic,
      name: '景点设置',
      icon: React.createElement(RightOutlined)
   },

   {
      name: '游园攻略',
      path: '/strategy',
      component: Strategy,
      icon: React.createElement(RightOutlined)
   },
   {
      path: '/dynamic',
      name: '在线互动',
      component: Dynamic,
      icon: React.createElement(RightOutlined)

   },

   {
      name: '知识讲堂',
      path: '/venue',
      component: Venue,
      icon: React.createElement(RightOutlined)
   },
   {
      name: '爱豆设置',
      path: '/idol',
      component: Idol,
      icon: React.createElement(RightOutlined)
   },
   {
      name: '树木认养',
      path: '/tree-adoption',
      render: (props) => {
         console.log(props);
         return renderRoutes(props?.route?.children)
      },
      children: [
         {
            path: '/tree-adoption/tree',
            name: '树木信息',
            component: TreeInfo,
            icon: React.createElement(RightOutlined)
         },
         {
            path: '/tree-adoption/adoption',
            name: '认养信息',
            component: TreeAdoption,
            icon: React.createElement(RightOutlined)
         }],
      icon: React.createElement(RightOutlined)
   }
] as RouteConfig[] & Route[];
